package edu.nmt.cs.cse326.team4.crap;

import java.util.HashMap;

import android.support.v4.app.FragmentActivity;
import android.view.View;
import android.widget.RatingBar;
import android.widget.TextView;

import com.google.android.gms.maps.GoogleMap.InfoWindowAdapter;
import com.google.android.gms.maps.model.Marker;

// Adding comment to update file. Hopefully it commits.

public class ToiletInfoWindowAdapter implements InfoWindowAdapter {

        private HashMap<Marker, Toilet> markerRef;
        private FragmentActivity map;
        
        public ToiletInfoWindowAdapter(HashMap<Marker, Toilet> mkmap, FragmentActivity m) {
                markerRef = mkmap;
                map = m;
        }
        
        public void setHashMap(HashMap<Marker, Toilet> mkmap) {
                markerRef = mkmap;
        }
        
        /*
         * Creates the view necessary to see the rating and title.
         * I realize that it's rather ugly right now. Need to create a custom rating bar for it.
         */
        @Override
        public View getInfoContents(Marker marker) {
                View infoWnd = map.getLayoutInflater().inflate(R.layout.activity_toiletinfowindow, null);
                RatingBar rating = (RatingBar) infoWnd.findViewById(R.id.infoWindowRatingBar);
                TextView title = (TextView) infoWnd.findViewById(R.id.infoWindowTitle);
                
                rating.setRating(markerRef.get(marker).getRating());
                title.setText(markerRef.get(marker).getName());
                
                return infoWnd;
        }

        @Override
        public View getInfoWindow(Marker arg0) {
                return null;
        }

}
